exports.add_organization_finance_info = function (req, res) {

    //获取参数
    var bodyParams = req.routeInfo.bodyParams;
    //最终结果
    var resultData = {};

    var organizationFinanceData = 0;
    //任务流创建
    async.waterfall([

            //1.查询当前账户是否已存在
            function (cb) {

                R.SEND_HTTP(
                    req,
                    {
                        url: CORE_APIConfig.coreAPI.searchOrganizationFinanceInfo + "/ofi_oid/" + bodyParams.ofi_oid,
                        method: 'POST',
                        data: {
                            fields: ["ofi_id"].join(",")
                        }
                    },
                    function (err, data) {
                        //判断是否有错误信息
                        if (err) {
                            return cb(err, data);
                        }
                        organizationFinanceData = data.data;
                        cb();
                    }
                );
            },
            function (cb) {

                if (organizationFinanceData.length !== 0) {
                    return RES.response(res, false, '账户信息已上传，请勿重复上传');
                }
                cb();
            },

            function (cb) {
                R.SEND_HTTP(
                    req,
                    {
                        url: CORE_APIConfig.coreAPI.addOrganizationFinanceInfo,
                        method: 'POST',
                        data: {
                            ofi_oid: bodyParams.ofi_oid,
                            ofi_account_type: bodyParams.ofi_account_type,
                            ofi_legal: bodyParams.ofi_legal,
                            ofi_account_name: bodyParams.ofi_account_name,
                            ofi_bank: bodyParams.ofi_bank,
                            ofi_bank_number: bodyParams.ofi_bank_number,
                            ofi_prove_image: bodyParams.ofi_prove_image,
                            ofi_branch: bodyParams.ofi_branch
                        }
                    },
                    function (err, data) {
                        // //console.log(data);
                        //判断是否有错误信息
                        if (err) {
                            return RES.response(res, false, data);
                        }
                        resultData.addData = data.data;
                        cb();
                    }
                );
            }
        ], function (err, result) {

            //返回最终拼接结果
            RES.response(res, true, resultData);

        }
    );

}